package ld.oauth.blog.model.po.user;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 权限表
 * </p>
 *
 * @author
 * @since 2022-09-03
 */
@Getter
@Setter
@TableName("sys_permission")
@ApiModel(value = "SysPermission对象", description = "权限表")
@ToString
public class SysPermission implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("权限 ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("父权限 ID (0为顶级菜单)")
    private Long parentId = 0L;

    @ApiModelProperty("根菜单")
    @TableField(exist = false)
    private String parentName = "根菜单";

    @ApiModelProperty("权限名称")
    private String name;

    @ApiModelProperty("授权标识符")
    private String code;

    @ApiModelProperty("授权路径")
    private String url;

    @ApiModelProperty("类型(1菜单，2按钮)")
    private Integer type;

    @ApiModelProperty("图标")
    private String icon;

    @ApiModelProperty("备注")
    private String remark;

    private LocalDateTime createDate;

    private LocalDateTime updateDate;

    @TableField(exist = false)
    private List<SysPermission> children = Lists.newArrayList();

    @TableField(exist = false)
    private List<String> childrenUrl = Lists.newArrayList();


}
